package team.dmh.wx.util;

import org.apache.tomcat.util.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @Auther: Hz1kai
 * @Date: 2018/10/16 11:18
 * @Description:
 */
public class MD5Utils {

    public static String encrypt(String str) throws NoSuchAlgorithmException {
        MessageDigest md5=MessageDigest.getInstance("MD5");
        return Base64.encodeBase64String(md5.digest(str.getBytes()));
    }

}
